'use strict';
const uniID = require('uni-id-common')
const ASE= require('ase')
exports.main = async (event, context) => {
	const uniIDIns = uniID.createInstance({
		context: context,
	})
	const res = await uniIDIns.checkToken(event.uniIdToken)
	const db = uniCloud.databaseForJQL({
			event,
			context 
		});
		event=JSON.parse(ASE.AES.decrypt(event.data,'yclycl1314520520','9740022097400220'))
		if(event.id==null){
			return null
		}
	const info=await db.collection("item").where({_id:event.id,user_id:res.uid}).update(event.update);
	await uniCloud.deleteFile({
		fileList: event.deleurl
	});
	return {msg:"更新成功"}
};
